Repository navigation
fix: avoid u32 overflow in statistics for full bitmaps - #358
Conversation
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
e8f7de8 to
595b8fa
Compare
|
Tested on top of current main (0439d57):
One note for release planning: changing a public field's type is a breaking change. |
|
Restored |
6982fa5
RoaringBitmap::full().statistics()accumulates 2^32 values in run containers. Theu32run-count field overflows with overflow checks enabled and wraps to zero without them. Widenn_values_run_containerstou64and remove the narrowing cast.Keep
n_values_array_containersasu32: at most 65,536 array containers can each hold 4,096 values, so its maximum is 2^28. The regression tests check the full bitmap and preserve the array field's existingu32API.Changing the public run-count field from
u32tou64is a breaking API change. Release placement is up to the maintainers.Validation on Rust 1.90.0 / macOS ARM64: the affected integration file passes all 12 tests in direct std and no-std builds with overflow checks enabled. Direct Clippy checks of the library and that test target pass with
-D warningsin both modes, andcargo fmt --all -- --checkpasses. The full Cargo suite was stopped during dependency compilation at the local build budget, before tests ran; serde, SIMD, property tests, doc tests and benchmarks remain unverified locally.Closes #357.
The follow-up scope correction and verification were assisted by OpenAI Codex.